package com.baomidou.springwind.test.Proxy;

/**
 * Created by Administrator on 2017-02-04.
 */
public class ReadObject implements Interface {

    private Object object;


    @Override
    public void doSomething() {
        System.out.println("doSomething");

    }

    @Override
    public void doElseThing(String args) {
        System.out.println("do somethis else" + args);
    }

}
    class SimpleProxy implements Interface {
        private Interface anInterface;

        public SimpleProxy(Interface anInterface) {
            this.anInterface = anInterface;
        }

        @Override
        public void doSomething() {
            System.out.println("S do something");
            anInterface.doSomething();
        }

        @Override
        public void doElseThing(String args) {
            System.out.println("S do somethis else" + args);
            anInterface.doElseThing(args);

        }
    }

        class SimpleProxyDemo {
            public static void consumer(Interface anInterface) {
                anInterface.doSomething();
                anInterface.doElseThing("  yhx");
            }
            public static void main(String[] args) {
                consumer(new ReadObject());
                consumer(new SimpleProxy(new ReadObject()));
            }

        }



